#include <iostream>
using namespace std;

class Stack
{
public:
	Stack(int capacity = 4)
	{
		int* newOnew = (int*)malloc(sizeof(int) * capacity);
		if (newOnew == NULL)
		{
			perror("malloc fail");
			return;
		}
		_a = newOnew;
		_top = 0;
		_capacity = capacity;

		cout << "Stack" << endl;
	}

	~Stack()
	{
		if (_a)
		{
			free(_a);
			_top = 0;
			_capacity = 0;
			_a = NULL;
		}
		cout << "~Stack" << endl;

	}

private:
	int* _a;
	int _top;
	int _capacity;
};

int main()
{
	Stack st(10);

	return 0;
}